﻿@model IEnumerable<Sprint1.Models.Course>
<link href="~/Content/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery-ui-1.10.4.custom.min.js"></script>
@{
    ViewBag.Title = "FindCourse";
}
<h2>FindCourse</h2>
<script type="text/javascript">
    $(function () {
        $("#txtSearch").autocomplete({
            source: '@Url.Action("GetCourses")'
        });
    });

</script>
<div style="font-family:'Segoe UI' ">
    @using (Html.BeginForm("FindCourse", "Student", FormMethod.Post))
    {
        <b>Name: </b>
        @Html.TextBox("searchTerm", null, new { id = "txtSearch" })
        <input type="submit" value="search">
    }

    <table border="1">
        @if (Model != null)
        {
            <tr>
                <th>
                    @Html.DisplayNameFor(model => model.Name)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Description)
                </th>
            </tr>
            foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.ActionLink(item.Name, "CourseInfo", new { id = item.Id })
                    </td>
                    <td>
                        @Html.DisplayTextFor(i => item.Description)
                    </td>
                </tr>
            }
        }
    </table>
</div>